package cn.jly.spring.boot.cloud.cron;

import cn.jly.spring.boot.cloud.dao.UserRepository;
import cn.jly.spring.boot.cloud.dto.UserExtendDto;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * @author lanyangji
 * @description quartz任务job2,
 * @date 2020/12/18 下午 7:23
 */
public class MyJob2 extends QuartzJobBean {
    UserRepository userRepository;

    public UserRepository getUserRepository() {
        return userRepository;
    }

    public void setUserRepository(UserRepository userRepository) {
        this.userRepository = userRepository;
    }

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        final UserExtendDto dto = userRepository.getById(1);
        System.out.println("dto = " + dto);
    }
}
